$(function() {
  $.fn.wait = function(time, type) {
    time = time || 3000;
    type = type || "fx";
    return this.queue(type, function() {
      var self = this;
      setTimeout(function() {
        $(self).dequeue();
      }, time);
    });
  };

  $('#flashMessage, #authMessage')
    .click(function() { $(this).hide(); })
    .wait().fadeOut();
});
